//
// NeL - bindings
// Copyright (C) 2010 Naush
//
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU Affero General Public License as
//published by the Free Software Foundation, either version 3 of the
//License, or (at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU Affero General Public License for more details.
//
//You should have received a copy of the GNU Affero General Public License
//along with this program.  If not, see <http://www.gnu.org/licenses/>.

package org.ryzom.nel.misc;

public class CAsyncFileManager {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CAsyncFileManager(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CAsyncFileManager obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nelmiscJNI.delete_CAsyncFileManager(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public static CAsyncFileManager getInstance() {
    return new CAsyncFileManager(nelmiscJNI.CAsyncFileManager_getInstance(), false);
  }

  public static void terminate() {
    nelmiscJNI.CAsyncFileManager_terminate();
  }

  public void loadFile(String fileName, SWIGTYPE_p_p_unsigned_char pPtr) {
    nelmiscJNI.CAsyncFileManager_loadFile(swigCPtr, this, fileName, SWIGTYPE_p_p_unsigned_char.getCPtr(pPtr));
  }

  public void loadFiles(Vector_String vFileNames, SWIGTYPE_p_std__vectorT_unsigned_char_pp_t vPtrs) {
    nelmiscJNI.CAsyncFileManager_loadFiles(swigCPtr, this, Vector_String.getCPtr(vFileNames), vFileNames, SWIGTYPE_p_std__vectorT_unsigned_char_pp_t.getCPtr(vPtrs));
  }

  public void signal(SWIGTYPE_p_bool pSgn) {
    nelmiscJNI.CAsyncFileManager_signal(swigCPtr, this, SWIGTYPE_p_bool.getCPtr(pSgn));
  }

  public void cancelSignal(SWIGTYPE_p_bool pSgn) {
    nelmiscJNI.CAsyncFileManager_cancelSignal(swigCPtr, this, SWIGTYPE_p_bool.getCPtr(pSgn));
  }

  public void addLoadTask(IRunnable ploadTask) {
    nelmiscJNI.CAsyncFileManager_addLoadTask(swigCPtr, this, IRunnable.getCPtr(ploadTask), ploadTask);
  }

  public boolean cancelLoadTask(SWIGTYPE_p_NLMISC__CAsyncFileManager__ICancelCallback cancelCallBack) {
    return nelmiscJNI.CAsyncFileManager_cancelLoadTask(swigCPtr, this, SWIGTYPE_p_NLMISC__CAsyncFileManager__ICancelCallback.getCPtr(cancelCallBack));
  }

}
